<template>
	<view>
		<w-list :list='list' text='您尚无物业订单' :status='status'>
			<template>
				<view v-for="(item,index) in list" :key="index">
					<w-bill-list :item='item'></w-bill-list>
				</view>
			</template>
		</w-list>
	</view>
</template>

<script>
	import {
		getHouseByHouse
	} from '@/api/index.js'
	import {
		mapState
	} from 'vuex'
	export default {
		computed: {
			...mapState(['userInfo'])
		},
		data() {
			return {
				list: [],
				pageNo: 1,
				status: 'loadmore'
			}
		},
		onLoad() {
			this.getHouseByHouse()
		},
		onPullDownRefresh() {
			this.list = []
			this.pageNo = 1
			this.getHouseByHouse()
		},
		onReachBottom() {
			this.status = 'loading'
			this.pageNo++
			this.getHouseByHouse()
		},
		methods: {
			getHouseByHouse() {
				getHouseByHouse({
					houseId: this.userInfo.house.id,
					name: this.userInfo.name,
					pageNo: this.pageNo,
					pageSize: 10
				}).then(res => {
					const arr = res.list
					if (arr.length == 10) {
						this.status = 'loadmore'
					} else {
						this.status = 'nomore'
					}
					this.list = this.list.concat(arr)
				})
			},
		}
	}
</script>

<style>

</style>
